#ifndef AER_POOLALLOCATOR_HPP_
#define AER_POOLALLOCATOR_HPP_

#include "../aerDefs.hpp"


namespace aer {

/// 
//template <typename T>
class PoolAllocator
{   
  private:
    void *m_data;            //  Allocated memory
    void *m_pFreeList;       //  Head to the list of free chunks
    
    U32 m_alignmentPadding;   //  Padding to align original data (in bytes)
    U32 m_capacity;           //  Total capacity of the pool
    U32 m_size;               //  Actual number of allocate elements
    U32 m_chunkSize;
    
   
  public:
    PoolAllocator();
    ~PoolAllocator();
    
    void initialize(const U32 numChunk, const U32 chunkSize);
    void release();
    
    void* allocate();
    void deallocate(void *p);
    
    U32 getCapacity() { return m_capacity; }
    U32 getSize() { return m_size; }
  
  
  private:
    void setupFreeChunkList();
  
  private:
    DISALLOW_COPY_AND_ASSIGN(PoolAllocator);
};
  
} // aer

#endif //AER_POOLALLOCATOR_HPP_
